package com.xone.xapp;

import android.app.Activity;
import android.os.Bundle;
import android.util.SparseArray;

public class GuideImageRoute {
	
	public static final SparseArray<Class<? extends Activity>> IMAGE_ROUTE = new SparseArray<Class<? extends Activity>>();
	public static final SparseArray<Bundle> IMAGE_EXTRA = new SparseArray<Bundle>();
	
//	+---------+--------------------+
//	| LINK_NO | NAME               |
//	+---------+--------------------+
//	| A001    | 促销产品           |
//	| A002    | 普通产品           |
//	| A003    | 组团产品           |
//	| A004    | 物流配送           |
//	| A006    | 用户中心           |
//	| A007    | 产品发布           |
//	| A008    | 促销发布           |
//	| A009    | 组团发布           |
//	| A010    | 求购发布           |
//	| A011    | 筛选订阅           |
//	| A012    | 联系客服           |
//	| A013    | 产品发布列表       |
//	| A014    | 促销发布列表       |
//	| A015    | 组团发布列表       |
//	| A016    | 求购发布列表       |
//	| A017    | 物流配送列表       |
//	| A018    | 我的广告列表       |
//	| A019    | 顶置申请列表       |
//	| A020    | 我的订阅列表       |
//	| A021    | 组团预定列表       |
//	| A005    | 用户注册           |
//	| A022    | 求购产品           |
//	+---------+--------------------+
	static {
		IMAGE_ROUTE.put(R.drawable.a001, ProductListActivity.class);
		IMAGE_EXTRA.put(R.drawable.a001, createBundle("saleType", "1"));
		IMAGE_ROUTE.put(R.drawable.a002, ProductListActivity.class);
		IMAGE_EXTRA.put(R.drawable.a002, createBundle("saleType", "0"));
		IMAGE_ROUTE.put(R.drawable.a003, ProductListActivity.class);
		IMAGE_EXTRA.put(R.drawable.a003, createBundle("saleType", "2"));
		IMAGE_ROUTE.put(R.drawable.a004, DeliveryCreateActivity.class);
		IMAGE_ROUTE.put(R.drawable.a005, RegisterActivity.class);
		IMAGE_ROUTE.put(R.drawable.a006, UserCenterActivity.class);
		IMAGE_ROUTE.put(R.drawable.a007, ProductCreateActivity.class);
		IMAGE_EXTRA.put(R.drawable.a007, createBundle("saleType", "0"));
		IMAGE_ROUTE.put(R.drawable.a008, ProductCreateActivity.class);
		IMAGE_EXTRA.put(R.drawable.a008, createBundle("saleType", "1"));
		IMAGE_ROUTE.put(R.drawable.a009, ProductCreateActivity.class);
		IMAGE_EXTRA.put(R.drawable.a009, createBundle("saleType", "2"));
		IMAGE_ROUTE.put(R.drawable.a010, PurchaseCreateActivity.class);
		IMAGE_ROUTE.put(R.drawable.a011, SubscribeCreateActivity.class);
		IMAGE_ROUTE.put(R.drawable.a013, ProductListUserActivity.class);
		IMAGE_EXTRA.put(R.drawable.a013, createBundle("saleType", "0"));
		IMAGE_ROUTE.put(R.drawable.a014, ProductListUserActivity.class);
		IMAGE_EXTRA.put(R.drawable.a014, createBundle("saleType", "1"));
		IMAGE_ROUTE.put(R.drawable.a015, ProductListUserActivity.class);
		IMAGE_EXTRA.put(R.drawable.a015, createBundle("saleType", "2"));
		IMAGE_ROUTE.put(R.drawable.a016, PurchaseListUserActivity.class);
		IMAGE_ROUTE.put(R.drawable.a017, DeliveryListActivity.class);
		IMAGE_ROUTE.put(R.drawable.a018, BannerListUserActivity.class);
		IMAGE_ROUTE.put(R.drawable.a019, OverheadListUserActivity.class);
		IMAGE_ROUTE.put(R.drawable.a020, SubscribeListUserActivity.class);
		IMAGE_ROUTE.put(R.drawable.a021, ProductGroupListUserActivity.class);
		IMAGE_ROUTE.put(R.drawable.a022, PurchaseListActivity.class);
		IMAGE_ROUTE.put(R.drawable.more, LinksActivity.class);
	}
	
	public static Bundle createBundle(String...keys) {
		if (null == keys) {
			throw new IllegalArgumentException("参数不能为null");
		}
		if (keys.length % 2 != 0 ) {
			throw new IllegalArgumentException("参数的键值个数不一致");
		}
		Bundle b = new Bundle();
		for (int i = 0; i < keys.length; i += 2) {
			b.putString(keys[i], keys[i + 1]);
		}
		return b;
	}

}
